package org.jwcloud.project.module.zx.txzldp.controller;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import org.jwcloud.project.module.zx.baseManager.service.repository.MatBaseManagerRepository;
import org.jwcloud.project.module.zx.common.FmtUtil;
import org.jwcloud.project.module.zx.common.Resp;
import org.jwcloud.project.module.zx.common.repository.RptCommonRepository;
import org.jwcloud.project.module.zx.common.service.RptUtService;
import org.jwcloud.project.module.zx.txzldp.service.repository.TxzldpCommonViewRepository;
import org.jwcloud.project.module.zx.workTime.service.repository.MatWorkTimeRepository;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import com.github.pagehelper.PageHelper;
import com.jw.mid.mm.comm.common.controller.BaseController;
import com.jw.mid.mm.comm.common.controller.CrudController;
import com.jw.mid.mm.comm.common.json.Response;
import com.jw.mid.mm.comm.common.pagination.ListBounds;
import com.jw.mid.mm.comm.common.pagination.ListSlice;
import com.jw.mid.mm.comm.common.pagination.PageListSlice;
import com.jw.mid.mm.comm.common.pagination.Pagination;
import com.jw.mid.mm.comm.common.service.CrudService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

@Api(value = "API - Controlle",
description = "巡视巡查问题：1.了解关注数  2.移交纪委         成案率 处置人数", tags = "jdNew")
@RestController
@Transactional
@RequestMapping("/rest/txzldp/xsXc")
public class TxzldpXsXcController extends BaseController{
	
	@Autowired
    private SqlSessionTemplate sqlSessionTemplate;
	
	@Autowired
    public RptUtService rptUtService;
	
	//了解关注数
	@RequestMapping("/ljgzs")
	public ModelAndView txzldpDoor(@RequestParam Map param, ModelAndView model) {
		model.setViewName("pages/xsXc/Ljgzs.html");
		return model;
	}
	//移交纪委数
	@RequestMapping("/yjjws")
	public ModelAndView Yjjws(@RequestParam Map param, ModelAndView model) {
		model.setViewName("pages/xsXc/Yjjws.html");
		return model;
	}
	//成案率 处置人数
	@RequestMapping("/cacz")
	public ModelAndView cacz(@RequestParam Map param, ModelAndView model) {
		model.setViewName("pages/xsXc/Cacz.html");
		return model;
	}
	
	@GetMapping("queryLjgzs")
    @ApiOperation(value = "", notes = "")
    @ApiImplicitParams({
    })
    public Resp queryLjgzs(
    		@RequestParam(required = false) Map<String,String> param
    		){
		return Resp.success(this.sqlSessionTemplate.selectList("txzldp.xsXc.queryLjgzs", param));
    }
	
	@PostMapping("insertLjgzs")
    @ApiOperation(value = "", notes = "")
    @ApiImplicitParams({
    })
    public Resp insertLjgzs(
    		@RequestBody(required = false) Map<String,String> param
    		){
		int num = this.sqlSessionTemplate.insert("txzldp.xsXc.insertLjgzs", param);
		return Resp.success(num);
//		if(num == 0) {
//			return Resp.error("年份重复");
//		}else {
//			return Resp.success(num);
//		}
    }
	
	@PostMapping("updateLjgzs")
    @ApiOperation(value = "", notes = "")
    @ApiImplicitParams({
    })
    public Resp updateLjgzs(
    		@RequestBody(required = false) Map<String,String> param
    		){
		return Resp.success(this.sqlSessionTemplate.update("txzldp.xsXc.updateLjgzs", param));
    }
	
	@PostMapping("deleteLjgzs")
    @ApiOperation(value = "", notes = "")
    @ApiImplicitParams({
    })
    public Resp deleteLjgzs(
    		@RequestBody(required = false) Map<String,String> param
    		){
		return Resp.success(this.sqlSessionTemplate.update("txzldp.xsXc.deleteLjgzs", param));
    }
	
	
	@GetMapping("queryYjjws")
    @ApiOperation(value = "", notes = "")
    @ApiImplicitParams({
    })
    public Resp queryYjjws(
    		@RequestParam(required = false) Map<String,String> param
    		){
		return Resp.success(this.sqlSessionTemplate.selectList("txzldp.xsXc.queryYjjws", param));
    }
	
	@PostMapping("insertYjjws")
    @ApiOperation(value = "", notes = "")
    @ApiImplicitParams({
    })
    public Resp insertYjjws(
    		@RequestBody(required = false) Map<String,String> param
    		){
		int num = this.sqlSessionTemplate.insert("txzldp.xsXc.insertYjjws", param);
		return Resp.success(num);
//		if(num == 0) {
//			return Resp.error("年份重复");
//		}else {
//			return Resp.success(num);
//		}
    }
	
	@PostMapping("updateYjjws")
    @ApiOperation(value = "", notes = "")
    @ApiImplicitParams({
    })
    public Resp updateYjjws(
    		@RequestBody(required = false) Map<String,String> param
    		){
		return Resp.success(this.sqlSessionTemplate.update("txzldp.xsXc.updateYjjws", param));
    }
	
	@PostMapping("deleteYjjws")
    @ApiOperation(value = "", notes = "")
    @ApiImplicitParams({
    })
    public Resp deleteYjjws(
    		@RequestBody(required = false) Map<String,String> param
    		){
		return Resp.success(this.sqlSessionTemplate.update("txzldp.xsXc.deleteYjjws", param));
    }
	
	
	
	
	
	@GetMapping("queryCacz")
    @ApiOperation(value = "", notes = "")
    @ApiImplicitParams({
    })
    public Resp queryCacz(
    		@RequestParam(required = false) Map<String,String> param
    		){
		return Resp.success(this.sqlSessionTemplate.selectList("txzldp.xsXc.queryCacz", param));
    }
	
	@PostMapping("insertCacz")
    @ApiOperation(value = "", notes = "")
    @ApiImplicitParams({
    })
    public Resp insertCacz(
    		@RequestBody(required = false) Map<String,String> param
    		){
		int num = this.sqlSessionTemplate.insert("txzldp.xsXc.insertCacz", param);
		return Resp.success(num);
//		if(num == 0) {
//			return Resp.error("年份重复");
//		}else {
//			return Resp.success(num);
//		}
    }
	
	@PostMapping("updateCacz")
    @ApiOperation(value = "", notes = "")
    @ApiImplicitParams({
    })
    public Resp updateCacz(
    		@RequestBody(required = false) Map<String,String> param
    		){
		return Resp.success(this.sqlSessionTemplate.update("txzldp.xsXc.updateCacz", param));
    }
	
	@PostMapping("deleteCacz")
    @ApiOperation(value = "", notes = "")
    @ApiImplicitParams({
    })
    public Resp deleteCacz(
    		@RequestBody(required = false) Map<String,String> param
    		){
		return Resp.success(this.sqlSessionTemplate.update("txzldp.xsXc.deleteCacz", param));
    }
	
}